Tuesday, September 28, 2004

Quick MultiThreading

This is some real quick good info for specific scenarios... If you
are writing some workflow logic of yours and in-between you realize that you
want to perform some tasks which would be time consuming but actually are
also apart from your actual business logic and so you would not want your
business logic to waste on performance by waiting for those tasks to
complete... Some of the examples of such tasks would be printing, cleaning
back-end, doing logging or tracing functionality etc...
Well this is when the System.Threading.ThreadPool class comes real
handy... There is a static method called QueueUserWorkItem... You can call
this method with the method that you want to execute Asynchronously... The
Threadpool will use the first available thread to process your request...
Now your main business logic does not need to wait for this function to
finish...
Now this function can as well give a call back but then it depends
upon your requirements...
Read more about it on MSDN...
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/
frlrfsystemthreadingthreadpoolclasstopic.asp




With Best Regards,
Mitesh Mehta
Email : miteshvmehta@gmail.com
http://cc.1asphost.com/miteshvmehta/

0 Comments:

Post a Comment

<< Home